package io.renren.minimito.service.impl;

import com.alibaba.druid.util.StringUtils;
import io.renren.minimito.entity.ImMsgEntity;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.minimito.dao.UmAreaDao;
import io.renren.minimito.entity.UmAreaEntity;
import io.renren.minimito.service.UmAreaService;


@Service("umAreaService")
public class UmAreaServiceImpl extends ServiceImpl<UmAreaDao, UmAreaEntity> implements UmAreaService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<UmAreaEntity> wrapper = new QueryWrapper<>();
        String key = (String) params.get("key");
        if (!StringUtils.isEmpty(key)){
            wrapper.like("name",key);
        }


        IPage<UmAreaEntity> page = this.page(
                new Query<UmAreaEntity>().getPage(params),
                wrapper
        );

        return new PageUtils(page);
    }

}